package com.iweb.util;

import java.util.List;

public class PageModel {

    private int recordCount;//总记录数
    private int pageNo;//当前页数
    private int pageSize = 6;//每页条数
    private int totalPages;//总页数
    private List<?> recordList;//查询的记录列表
    private String likeValue;//查询条件

    public PageModel() {
    }

    public PageModel(int recordCount, int pageNo, int pageSize, int totalPages, List<?> recordList, String likeValue) {
        this.recordCount = recordCount;
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.totalPages = totalPages;
        this.recordList = recordList;
        this.likeValue = likeValue;
    }

    public int getRecordCount() {
        return recordCount;
    }

    public void setRecordCount(int recordCount) {
        this.recordCount = recordCount;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPages() {
        return this.recordCount % this.pageSize == 0
                ? this.recordCount / this.pageSize
                : (this.recordCount / this.pageSize + 1);
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public List<?> getRecordList() {
        return recordList;
    }

    public void setRecordList(List<?> recordList) {
        this.recordList = recordList;
    }

    public String getLikeValue() {
        return likeValue;
    }

    public void setLikeValue(String likeValue) {
        this.likeValue = likeValue;
    }

    @Override
    public String toString() {
        return "PageModel{" +
                "recordCount=" + recordCount +
                ", pageNo=" + pageNo +
                ", pageSize=" + pageSize +
                ", totalPages=" + totalPages +
                ", recordList=" + recordList +
                ", likeValue='" + likeValue + '\'' +
                '}';
    }
}
